package controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import service.KclrService;
import service.TeacherTableService;
import utils.PageObject;

import javax.annotation.Resource;

@RestController
@CrossOrigin
@RequestMapping("/kclr")
public class KclrController {
    /**
     * 服务对象
     */
    @Resource
    private KclrService kclrservice;

    @RequestMapping("/insert")
    @CrossOrigin
    @ResponseBody
    public JSONObject insert(@RequestBody JSONObject insertobj){
        JSONObject insert = kclrservice.insert(insertobj);
        return insert;
    }

    @RequestMapping("/selectbylimit")
    @CrossOrigin
    public PageObject selectallbylimit(@RequestBody JSONObject limitobj){
        PageObject pageObject = kclrservice.queryAllByLimit(limitobj);
        return pageObject;
    }

    @RequestMapping("/delete")
    @CrossOrigin
    public boolean delete(@RequestBody JSONObject insertobj){
        return  kclrservice.deleteById(insertobj.getInteger("id"));

    }
}
